const arr = [
  {
    stuNo: 100,
    stuName: "王五",
    stuClass: 1,
    teacherNo: 5,
    teacherName: "王涛",
  },
  {
    stuNo: 1001,
    stuName: "王五1",
    stuClass: 11,
    teacherNo: 51,
    teacherName: "王涛1",
  },
  {
    stuNo: 1002,
    stuName: "王五2",
    stuClass: 12,
    teacherNo: 52,
    teacherName: "王涛2",
  },
];

function getSubItemsFrmArr<T extends Array<any>>(
  arr: T,
  ...rest: any[]
): any[] {
  const res: any[] = [];
  arr.forEach((item) => {
    const cur = {} as any;
    rest.forEach((o) => {
      cur[o] = item[o];
    });

    res.push(cur);
  });

  return res;
}

getSubItemsFrmArr(arr, "stuClass", "stuNo").forEach((item) => {
  console.log(item);
});

export {};
